package com.legendshop.permission.dao;

import java.util.List;

import com.legendshop.dao.Dao;
import com.legendshop.dao.support.CriteriaQuery;
import com.legendshop.dao.support.PageSupport;
import com.legendshop.framework.commond.JCFException;
import com.legendshop.oa.model.Permission;
import com.legendshop.oa.model.Role;
/**
 *  角色Dao
 *
 */
public interface RoleDao  extends Dao<Role, Long>{

	/**
	 * Find role by function.
	 * 
	 * @param functionId
	 *            the function id
	 * @return the list
	 * @throws JCFException
	 *             the jCF exception
	 */
	public abstract List<Role> FindRoleByFunction(Long functionId) throws JCFException;

	/**
	 * Delete permission by role id.
	 * 
	 * @param permissions
	 *            the permissions
	 */
	public abstract void DeletePermissionByRoleId(List<Permission> permissions);

	/**
	 * Find role by user id.
	 * 
	 * @param userId
	 *            the user id
	 * @return the list
	 * @throws JCFException
	 *             the jCF exception
	 */
	public abstract List<Role> FindRoleByUserId(Long userId,  String appNo) throws JCFException;

	public abstract void updateRole(Role role);

	public abstract void deleteRole(Role role);

	public abstract void deleteRoleById(Long roleId);

	public abstract List<Permission> getPermissionByRoleId(Long roleId);

	public abstract Role getRoleById(Long id);

	public abstract Long saveRole(Role role);

	public abstract PageSupport<Role> queryRole(String search, String curPageNO, String myAction,CriteriaQuery cq);

	public abstract  PageSupport<Role> FindOtherRoleByUser(String curPageNO, Long userId, String appNo);

}